import { store } from "@/store"
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { urls } from '@/security/paths'

export const useMenusStore = defineStore("Menus", () => {

	// 记录各个页面滚动的位置
    const scrollIntoIdMap = new Map()

	const AnchorCenter = "anchorCenter"
    const SUB01 = "sub1"
    const SUB02 = "sub2"

	const moreApply = ref<any[]>([
		{
			title: '统计数据',
			icon: 'icon-tongji',
			links: [
				{ name: '新增用户', alias: 'addUser', isTabBar: false, icon: 'icon-xinzengyonghu', url: urls.UserIncrease, remark: '统计每天新增用户数' },
				{ name: '用户活跃', alias: 'activeUser',  isTabBar: false, icon: 'icon-huoyueyonghu', url: urls.UserActive, remark: '统计每天上线用户数'   },
			]
		},
		{
			title: '主播中心',
			icon: 'icon-zhubozhongxin',
			links: [
				{ name: '主播列表', alias: 'home', isTabBar: true, icon: 'icon-zhubozhongxin', url: urls.Anchor, remark: '主播信息' },
				{ name: '主播申请', alias: 'anchorApply',  isTabBar: true, icon: 'icon-yonghuzhuce', url: urls.Apply, remark: '审批主播申请,判定主播申请通过或拒绝'   },
				{ name: '主播视频', alias: 'anchorPersonVideo',  isTabBar: true, icon: 'icon-shipin', url: urls.Video , remark: '主播封面视频,每个主播只能有一个视频' },
				{ name: '主播专辑', alias: 'anchorPersonAblum',  isTabBar: true, icon: 'icon-xiangce', url: urls.Ablum, remark: '主播个人照片,可以上传多张'   },
				{ name: '主播钱包', alias: 'anchorWallet',  isTabBar: false, icon: 'icon-wallet', url: urls.WalletList, remark: '钱包金额,钱包明细,钱包日报'   },
				{ name: '视频通话', alias: 'callVideo',  isTabBar: false, icon: 'icon-tonghua', url: urls.CallList, remark: '主动发起和用户拨打进来的记录'   },
				{ name: '收到礼物', alias: 'receiveGift',  isTabBar: false, icon: 'icon-liwu', url: urls.GiftList, remark: '主播收到礼物记录'   },
			]
		},
		{
			title: '用户中心',
			icon: 'icon-yonghuzhuce',
			links: [
				{  name: '用户列表', alias: 'userList',  isTabBar: false, icon: 'icon-yonghu',  url: urls.UserList ,remark: '用户信息'},
				{  name: '用户钱包', alias: 'userWalletIndex',  isTabBar: false, icon: 'icon-shouyimingxi',  url: urls.UserWallet ,remark: '钱包金额,钱包明细,钱包日报,钱包充值'},
				{  name: '用户VIP', alias: 'userVip',  isTabBar: false, icon: 'icon-vip',  url: urls.UserVip , remark: '添加vip,vip到期时间'},
				{  name: '充值订单', alias: 'rechargeRecords',  isTabBar: false, icon: 'icon-taojinbi',  url: urls.UserRecharge , remark: '金币充值订单'},
			]
		},
		{
			title: '后台设置',
			icon: 'icon-shezhi',
			links: [
				{ name: '代理商', alias: 'organization',  isTabBar: false, icon: 'icon-dailishang',  url: urls.OrganizationList ,remark: '代理商列表、添加、编辑、删除'},
				{ name: '默认费率', alias: 'defalutRate',  isTabBar: false, icon: 'icon-feishuaiguanli',  url: urls.DefaultRate  ,remark: '默认充值、提现费率'},
				{ name: '用户费率', alias: 'userRate',  isTabBar: false, icon: 'icon-feishuai',  url: urls.UserRate  ,remark: '用户充值、提现费率'},
				{ name: '系统设置', alias: 'defConfig',  isTabBar: false, icon: 'icon-xitongpeizhi',  url: urls.DefConfig  ,remark: '系统各类参数配置'},
				{ name: '视频默认配置', alias: 'videoConfig',  isTabBar: false, icon: 'icon-shipinpeizhi01',  url: urls.VideoConfig  ,remark: '所有用户视频通话次数及通话时长'},
				{ name: '主播APP版本', alias: 'anchorAppVersion',  isTabBar: false, icon: 'icon-guanfangbanben',  url: urls.AppVersion  ,remark: '主播app版本记录'},
			]
		}
	])

	 /** 记录各个页面滚动的位置 */
    function setScrollerId(name: string, id: string){
        scrollIntoIdMap.set(name, id)
    }

    /** 获取页面滚动位置 */
    function getScrollerId(name: string) {
        return scrollIntoIdMap.get(name)
    }
		
	return {
		moreApply, 
		setScrollerId, getScrollerId
	}
})

export function useMenusStoreHook() {
	return useMenusStore(store);
}